package com.breeze.components.socket;

import com.breeze.components.socket.vo.WebSocketRequest;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;

/**
 * websocket事件
 *
 * @author breeze
 */
@Getter
public class WebSocketEvent extends ApplicationEvent {

  public static final String EVENT_TYPE_OPEN = "open";
  public static final String EVENT_TYPE_CLOSE = "close";
  public static final String EVENT_TYPE_MESSAGE = "message";

  private final WebSocket webSocket;
  private final String eventType;
  private WebSocketRequest request;

  public WebSocketEvent(WebSocket webSocket, String eventType) {
    super(webSocket);
    this.webSocket = webSocket;
    this.eventType = eventType;
  }

  public WebSocketEvent(WebSocket webSocket, String eventType, WebSocketRequest request) {
    super(webSocket);
    this.webSocket = webSocket;
    this.eventType = eventType;
    this.request = request;
  }
}
